<?php


namespace App\Services;

use Encore\Admin\Grid;

class ColumnService
{

    public function created_at(Grid $grid,$format='Y-m-d')
    {
        return $grid->column('created_at', __('Created at'))->display(function($value)use($format){
            $format = $format?:'Y-m-d';
            return date($format,strtotime($value));
        });
    }

    public function updated_at(Grid $grid,$format='Y-m-d')
    {
        return $grid->column('updated_at', __('Updated at'))->display(function($value)use($format){
            $format = $format?:'Y-m-d';
            return date($format,strtotime($value));
        });
    }
}
